package cn.dankal.flyaudio.adapter;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

import cn.dankal.basiclib.base.activity.BigPhotoActivity;
import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewAdapter;
import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewHolder;
import cn.dankal.basiclib.util.ActivityUtils;
import cn.dankal.basiclib.util.image.PicUtils;
import cn.dankal.flyaudio.R;
import cn.dankal.flyaudio.friend.utils.takevideo.utils.LogUtils;

import static cn.dankal.basiclib.base.activity.BigPhotoActivity.URLS;

/**
 * <pre>
 *     e-mail : junfeng.nie@duntech.com.cn
 *     time   : 9/8/2020
 *     desc   :
 *     version: cn.dankal.flyaudio.adapter
 *     Copyright: Copyright（c）2018
 *     Company:
 * </pre>
 *
 * @author niejunfeng
 */
public class EvaluateImgAdapter extends BaseRecyclerViewAdapter<String> {
    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.item_evaluate_img;
    }

    @Override
    protected BaseRecyclerViewHolder getViewHolder(ViewGroup parent, View rootView, int viewType) {
        return new EvaluateImgAdapter.ViewHolder(rootView);
    }

    class ViewHolder extends BaseRecyclerViewHolder<String> {

        public ViewHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void onBindData(String data, int position) {
            LogUtils.e(data);


            PicUtils.loadNormal(data, itemView.findViewById(R.id.iv_icon));
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Bundle bundle = new Bundle();
                    bundle.putStringArrayList(URLS, (ArrayList<String>) getDatas());
                    bundle.putInt(BigPhotoActivity.PicIndex, position);
                    ActivityUtils.startActivity(bundle, BigPhotoActivity.class);
                }
            });
        }
    }
}
